import request from '@/utils/request'

// 获取API配置列表
export function getDeviceApiConfigs(venueId, params) {
  return request({
    url: `/api/v1/admin/venues/${venueId}/device-api-configs`,
    method: 'get',
    params
  })
}

// 添加新的API配置
export function addDeviceApiConfig(venueId, data) {
  return request({
    url: `/api/v1/admin/venues/${venueId}/device-api-configs`,
    method: 'post',
    data
  })
}

// 获取单个API配置详情
export function getDeviceApiConfig(configId) {
  return request({
    url: `/api/v1/admin/device-api-configs/${configId}`,
    method: 'get'
  })
}

// 更新API配置
export function updateDeviceApiConfig(configId, data) {
  return request({
    url: `/api/v1/admin/device-api-configs/${configId}`,
    method: 'put',
    data
  })
}

// 删除API配置
export function deleteDeviceApiConfig(configId) {
  return request({
    url: `/api/v1/admin/device-api-configs/${configId}`,
    method: 'delete'
  })
}

// 执行一个API调用
export function executeDeviceApi(configId, data) {
  return request({
    url: `/api/v1/admin/device-api-configs/${configId}/execute`,
    method: 'post',
    data
  })
}